/*
* @author suhong
* @date 2022/5/19 22:24
* @file headImg.js
* @说明  上传图片的处理
*/
const path = require("path");
const fs = require("fs");
exports.headImg=(req, res)=>{
    let oldname=req.files[0].path//获取path
    let newname = (req.files[0].path + path.parse(req.files[0].originalname).ext)//.jpg
    fs.renameSync(oldname, newname)
    newname = "http://localhost:5000/" + newname.replace("public\\", "").replace('\\', '/')
    return newname
}